<?php
class Empresa extends AppModel {

	var $name = 'Empresa';
	var $displayField = 'fantasia';
	var $actsAs = array('CakePtbr.Validacao');
	var $validate = array(
		'cnae_id' => array('notempty'),
		'fantasia' => array('notempty'),
		'razaoSocial' => array('notempty'),
		'cnpj' => array(
			'rulecnpj' => array(
				'rule' => array('cnpj', true),
				'message' => 'CNPJ incorreto'),
			'ruleisUnique' => array(
				'rule' => 'isUnique',
				'message' => 'CNPJ ja cadastrado'
			)
		));

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
		'Cnae' => array(
			'className' => 'Cnae',
			'foreignKey' => 'cnae_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	var $hasMany = array(
		'Funcionario' => array(
			'className' => 'Funcionario',
			'foreignKey' => 'empresa_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
?>